<!doctype html><html lang=cn-zh><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta http-equiv=X-UA-Compatible content="IE=edge"><style type=text/css>body{font-family:monospace}</style><title>[Jenkins]Error:403 No valid crumb was included in the request</title>
<meta name=description content="A blog maintained by Vimiix."><link rel=stylesheet href=/css/style.css><script>var _hmt=_hmt||[];(function(){var e,t=document.createElement("script");t.src="https://hm.baidu.com/hm.js?7c24231917964240bae97e813810620c",e=document.getElementsByTagName("script")[0],e.parentNode.insertBefore(t,e)})()</script></head><body><header>====================<br>== Hi, I'm Vimiix ==<br>====================<div style=float:right;color:gray;font-size:x-large>Get hands dirty.</div><br><p><nav><a href=https://www.vimiix.com/><b>首页</b></a>.
<a href=/posts/><b>文章列表</b></a>.
<a href=/projects/><b>开源项目</b></a>.
<a href=/tags/><b>标签</b></a>.
<a href=/friends/><b>友链</b></a>.
<a href=/about/><b>关于我</b></a>.
<a href=/index.xml><b>RSS</b></a>.</nav></p></header><main><article><h1>[Jenkins]Error:403 No valid crumb was included in the request</h1><b><time>2018.01.31 12:27</time></b>
<a href=/tags/ci>CI</a>
<a href=/tags/error>ERROR</a>
<a href=/tags/jenkins>jenkins</a>
<a href=/tags/csrf>csrf</a><div><h1 id=错误备忘>错误备忘</h1><p>配置 <code>jenkins</code> 的时候，一直报这个错，是因为 <code>jenkins</code> 默认安全设置里面开启了 <code>防止款站点请求伪造</code>。</p><h3 id=方法>方法：</h3><blockquote><p>取消勾选这一项，就可以成功集成了</p></blockquote><p>位置： <code>Jenkins > 全局安全配置 > CSRF Protection</code></p><p><figure><img src=https://static.vimiix.com/uPic/2021-04-06/VJvLEn.jpg alt></figure></p><p>以前配置的时候都会上来先关掉这个，今天忘记了，一直报标题的错误。特记录下来，防止自己以后再忘记。</p><h1 id=附让-jenkins-以-root-权限执行-shell-命令>附：让 jenkins 以 root 权限执行 shell 命令</h1><ol><li>打开此脚本（使用 VIM 或其他编辑器）：</li></ol><pre tabindex=0><code>vim /etc/sysconfig/jenkins
</code></pre><ol start=2><li>找到 <code>$JENKINS_USER并更改为“root”</code>：</li></ol><pre tabindex=0><code>$JENKINS_USER=&#34;root&#34;
</code></pre><ol start=3><li>然后更改 Jenkins 主页，webroot 和日志的所有权：</li></ol><pre tabindex=0><code>chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins
</code></pre><ol start=4><li>重新启动 Jenkins 并检查用户是否已更改：</li></ol><pre tabindex=0><code>service jenkins restart
ps -ef | grep jenkins
</code></pre><h5 id=参考链接>参考链接：</h5><ul><li><a href=https://stackoverflow.com/questions/44711696/spinnaker-403-no-valid-crumb-was-included-in-the-request>[stackoverflow]403 No valid crumb was included in the request</a></li><li><a href=https://stackoverflow.com/questions/29926773/run-shell-command-in-jenkins-as-root-user>[stackoverflow]un shell command in jenkins as root user?</a></li></ul></div></article></main><aside><div><div><h3>LATEST POSTS</h3></div><div><ul><li><a href=/posts/2025-10-16-kubernetes-apiserver-authorization-mechanism/>Kubernetes APIServer 鉴权机制</a></li><li><a href=/posts/2025-09-30-kubernetes-apiserver-authentication-mechanism/>Kubernetes APIServer 认证机制</a></li><li><a href=/posts/2024-12-16-deploy-kubernetes-by-kubeadm/>使用 kubeadm 搭建 kubernetes 集群</a></li><li><a href=/posts/2024-09-20-how-to-code-review/>如何做code review</a></li><li><a href=/posts/2024-08-12-weakref-in-python/>Python中的弱引用</a></li></ul></div></div></aside><footer><p>Social Links:
<a href=https://github.com/vimiix><b>Github</b></a>.
<a href=https://www.douban.com/people/vimiix/><b>Douban</b></a>.
<a href=mailto:i@vimiix.com><b>Email</b></a>.<br><hr>&copy; 2017-2025
Vimiix Yao; All rights reserved.
<a href=https://beian.miit.gov.cn/>京ICP备19015214号-1</a></p><script src=https://l2dwidget.js.org/lib/L2Dwidget.min.js></script><script>L2Dwidget.init({model:{jsonPath:"https://unpkg.com/live2d-widget-model-tororo@1.0.5/assets/tororo.model.json"}})</script></footer></body></html>